package com.example.service;

import com.example.entity.MedicalService;
import com.example.mapper.MedicalServiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicalServiceService {
    
    @Autowired
    private MedicalServiceMapper medicalServiceMapper;

    public void addMedicalService(MedicalService medicalService) {
        medicalServiceMapper.insert(medicalService);  // 记录医疗服务
    }

    public MedicalService getMedicalServiceById(int id) {
        return medicalServiceMapper.selectById(id);  // 查询医疗服务
    }

    public List<MedicalService> getAllMedicalServices() {
        return medicalServiceMapper.selectList(null);  // 查询所有医疗服务
    }

    public void updateMedicalService(MedicalService medicalService) {
        medicalServiceMapper.updateById(medicalService);  // 更新医疗服务
    }

    public List<MedicalService> getMedicalServicesByInsuredPersonId(int insuredPersonId) {
        return medicalServiceMapper.getMedicalServicesByInsuredPersonId(insuredPersonId);
    }


    public void deleteMedicalService(int id) {
        medicalServiceMapper.deleteById(id);  // 删除医疗服务
    }
}
